import $axios from "@/network";

/**
 * 查询数据库服务列表
 * @returns {*}
 */
export const queryServiceList = (current, size) => {
    return $axios({
        method: 'POST',
        url: '/data/dataBase/query/list',
        data: {
            "current" : current,
            "size" : size,
        }
    })
}
/**
 * 创建服务
 * @returns {*}
 */
export const createdDataBase = (param) => {
    return $axios({
        method: 'POST',
        url: '/data/dataBase/save',
        data : param,
        headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'}

    })
}
/**
 * 根据id查询服务
 * @returns {*}
 */
export const queryBaseById = (id) => {
    return $axios({
        method: 'GET',
        url: '/data/dataBase/query',
        params: {
            "baseId" : id,
        }
    })
}
/**
 * 修改服务
 * @returns {*}
 */
export const updatedDataBase = (param) => {
    return $axios({
        method: 'POST',
        url: '/data/dataBase/edit',
        data: param,
        headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'}

    })
}
/**
 * 删除服务
 * @returns {*}
 */
export const deleteDataBase = (id) => {
    return $axios({
        method: 'GET',
        url: '/data/dataBase/delete',
        params: {
            "baseId" : id,
        }
    })
}
/**
 * 开启/关闭服务
 * @returns {*}
 */
export const updateDataBaseState = (id, state) => {
    return $axios({
        method: 'GET',
        url: '/data/dataBase/updateState',
        params: {
            "baseId" : id,
            "baseState" : state,
        }
    })
}
/**
 * 条件查询
 * @returns {*}
 */
export const queryDataBaseListByCondition = (current, size, form) => {
    return $axios({
        method: 'POST',
        url: '/data/dataBase/query/condition',
        data: {
            "current" : current,
            "size" : size,
            "baseName" : form.baseName,
            "baseDate" : form.baseDate + "",
        }
    })
}